package com.fengye.algorithms.leecode;

/**
 * @Author fengye
 * @Date 2023/4/10 9:19
 **/
public class ReverseWords557 {
    public String reverseWords(String s) {
        String[] sArr = s.split(" ");
        StringBuilder sb = new StringBuilder();
        for(int i=0;i<sArr.length;i++) {
            StringBuilder subSb = new StringBuilder(sArr[i]);
            sb.append(subSb.reverse());
            if(i<sArr.length-1) {
                sb.append(" ");
            }
        }
        return sb.toString();
    }
}
